<!--# layout("/common/layout.html",{"jsBase":"/js/spread/channel/"}){ -->

<form class="layui-form layui-form-pane" id="addForm"  lay-filter="editform">
    <input type="hidden" name="promoteCode" id="promoteCode">

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="promoteName" id="promoteName" autocomplete="off" class="layui-input" lay-verify="required">
                </div>
            </div>

            <div class="layui-inline">
            <label class="layui-form-label">所属渠道</label>
				<div class="layui-input-inline">
                    <layui:simpleDataSelect name="channelCode" value="" data="${channels}"
                                            attrId="channelCode" attrName="channelName" laySearch="true"/>
				</div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <!--#if(accessType>1){ -->
            <div class="layui-inline">
                <label class="layui-form-label">发起人类型</label>
                <div class="layui-input-inline">
                    <layui:simpleDictSelect style='layui-input-inline' type="channel_type" layVerify=""
                                            id="promoterType" name="promoterType" value="" />
                </div>
            </div>
            <!--#}-->
            <!--#if(accessType==6){ -->
            <div class="layui-inline">
            <label class="layui-form-label">所属公司</label>
				<div class="layui-input-inline">
                    <layui:simpleDataSelect name="orgId" value="" data="${orgList}"
                                            attrId="id" attrName="name"/>
				</div>
            </div>
            <!--#}-->
        </div><!--form item-->
    </div><!--row-->
<div class="layui-row">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block" style="width:512px">
                                <textarea name="promoteMemo"  id="promoteMemo" placeholder="请输入" class="layui-textarea" ></textarea>
            </div>
        </div>
    </div>
</div>
<div class="layui-row">
    <div class="layui-form-item">
				</div>
            </div>
        </div>
    </div>
    <layui:submitButtons id="addButton" />
</form>
<!--#} -->
<script>
layui.define([ 'form', 'laydate', 'table','channelApi'], function(exports) {
    var form = layui.form;
    var channelApi = layui.channelApi;
    var index = layui.index;
    var isNew = true;
    <!--# if(!(isEmpty(promoteRecordJson))){  -->
    isNew = false;
    <!--# } -->
    var view = {
        init:function(){
            Lib.initGenrealForm($("#addForm"),form);
            this.initSubmit();
        },
        initSubmit:function(){
            $("#addButton").click(function(){
                form.on('submit(form)', function(){
                    channelApi.saveForm(isNew,$('#addForm'),function(){
                        parent.window.dataReload();
                        Common.info("保存成功");
                        Lib.closeFrame();
                    });
                });
            });

            $("#addButton-cancel").click(function(){
                Lib.closeFrame();
            });
        }

    }
    view.init();
    <!--# if(!(isEmpty(promoteRecordJson))){  -->
    var formJson = ${promoteRecordJson};
    form.val("editform",formJson);
    <!--# } -->
});
</script>
